package com.itheima.stock.controller;

import com.itheima.stock.pojo.StockBusiness;
import com.itheima.stock.service.StockService;
import com.itheima.stock.vo.resp.PageResult;
import com.itheima.stock.vo.resp.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * @author by itheima
 * @Date 2021/12/19
 * @Description
 */
@RestController
@RequestMapping("/api/quot")
@CrossOrigin
public class StockController {

    @Autowired
    private StockService stockService;




    @GetMapping("/index/all")
    public R<List<Map>> getInnerStockMarket(){
        return stockService.getInnerStockMarket();
    }

    @GetMapping("/sector/all")
    public R<List<Map>> getSectorAll(){
        return stockService.getSectorAllLimit();
    }

    @GetMapping("/stock/increase")
    public R<List<Map>> getStockIncrease() {
        return stockService.getStockIncrease();
    }

    @GetMapping("/stock/all")
    public R<PageResult> getStockAll(Integer page,Integer pageSize) {
        return stockService.getStockAll(page, pageSize);
    }

    @GetMapping("/stock/updown/count")
    public R<Map> getStockUpdownCount() {

        return stockService.getStockUpdownLimitCount();
    }

    @GetMapping("/stock/export")
    public void exPort(HttpServletResponse response, Integer page, Integer pageSize) {
        this.stockService.exportStockExcel(response, page, pageSize);
    }

    @GetMapping("/stock/tradevol")
    public R<Map> getStockTravolCompare() {
        return stockService.getStockTravolCompare();
    }

    @GetMapping("/stock/updown")
    public R<Map> getStockUpdown() {
        return stockService.getStockUpdownScope();
    }

    @RequestMapping("/stock/screen/time-sharing")
    public R<List<Map>> getStockRtInfoByCode4EvrMinute(@RequestParam("code") String sotckCode){
        return stockService.getStockScreenMinuteSharing(sotckCode);
    }

    @RequestMapping("/stock/screen/dkline")
    public R<List<Map>> getDayKLinData(@RequestParam("code") String stockCode){
        return stockService.getDayKLinData(stockCode);
    }
} 